<?php

/*
 *
 *
 * This software has been made FREE by author for the interest of other developers. 
 *      I hope this will help you in coding faster and robust php code
 *            You can modify and redistribute it as you like.
 *              Your comments, suggestions and corrections 
 *                          will be highly 
 *                           APPRECIATED. 
 *                                      Author
 * @author :   Roshan Budhathoki (developer.roshan@gmail.com);
 * @URL    :   <http://www.roshanbudhathoki.com>
 *
 * 
 * Main Launcher for Myhighst Admin
 */
// Define Session name for admi
session_name('myhighst_admin');

// Start the session
session_start();

// Define Directory Separator
define('DS', DIRECTORY_SEPARATOR);

//Define Application Path

define('APP_PATH', dirname(__FILE__) . DS);
define('ADMIN_PATH', APP_PATH);
// enable debugging
ini_set('display_errors', true);
error_reporting(E_ALL);
// start cache
ob_start('ob_gzhandler');
ob_implicit_flush(false);



if (!file_exists('..' . DS . 'includes' . DS . 'config.php')) {
    die('No configuration Found');
}
include '..' . DS . 'includes' . DS . 'config.php';


include INCLUDE_PATH . 'load.php';

// check global array hack
unregister_globals();

// check user login
if (!admin_logged_in()) {
    Params::setParam('page', 'login');
}



if (!Params::getParam('page')) {
    Params::setParam('page', 'index');
}




switch ($_GET['page']) {
    case 'login':
        include admin_code_path().'login.php';
        break;
    case 'categories':
        include admin_code_path() . 'categories.php';
        break;
    case 'items':
        include admin_code_path().'items.php';
        break;
    case 'index':
        include cp_template_path().'home.php';
        break;
    case 'unit':
    	$args=array();
    	$args['category_id']=100;
    	$fields=array();
        $fields['image']='image_name';
        $fields['name']='same';
       	categories::newInstance()->update($args,$fields);
    	break;
    default:
        echo '404 PAGE';
        break;
}

?>
